//采用集中式存储管理应用的所有组件的状态
import { defineStore } from 'pinia'
import { setStorage, getStorage } from '@/utils/storage'
console.log(getStorage('token'))
//创建store
export const useUserStore = defineStore('user', {
  state: () => ({
    token: getStorage('token') || ''
  }),
  actions: {
    //修改token
    updateToken(token) {
      console.log(token)
      setStorage('token', token)
      this.token = token
    }
  }
})
